home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Alles Voor Internet / Tout Pour Internet
/
alles voor internet.iso
/
MacInternet™
/
Telnet
/
Comet.3.0.7 Folder
/
ibm-host-software
/
UPLOAD.EXEC
< prev
next >
Wrap
Text File
|
1988-05-24
|
5KB
|
133 lines
/*
Use this exec to transfer IBM PC or Mac files to CMS via FT3270 or FTC19.
SYNTAX: UPLOAD <">micro_filespec<"> <fn|* <ft|* <fm>>> <( options <)>>
options are: <REPlace> <BINary|TEXt> <lrecl>
Notes:
1) Micro_filespec must be enclosed in double quotes if it contains blanks.
2) CMS fn & ft default to first & second parts of micro_filespec
respectively. CMS fm defaults to 'A'.
3) Three options are checked for. Invalid words are ignored.
4) REPLACE means the CMS file will be replaced with the transferred one. The
default is to return an error if a CMS file of that name already exists.
5) BINARY means that a binary translation will take place with no ASCII/
ebcdic translation and no special attention paid to local CR/LF's.
6) The TEXT option means that the program will perform the ebcdic/ASCII
translation and cut loose a record when a local line feed character is
encountered.
7) The default is to let the micro decide whether to make the transfer TEXT
or BINARY and so inform the CMS program.
8) A number less than 65536 may be specified to indicate the creation of a
CMS file of fixed record length. If it is not specified then a file of
variable length records is created.
*/
address 'COMMAND'
/* modified for mac to preserve slash marks kevin 11/3/87 */
/* 5-5-88 Rich K split path/name based on forward or backslashes */
/* 5-13-88 RICH K. FIX BUG WHEN RDR FILE ARRIVES SPOOLED TO CURRENT */
/* READER SETTING */
/* 5-24-88 Rich K. Add test for disk not in write mode */
/* Parse the arguments and build the CMS FN FT FM if necessary */
parse arg parms '(' opts ')'
if parms = '' | parms = '?' then signal help
/* Split the micro filespec from the CMS FN FT FM. The filespec may
be surrounded by quotes to remove ambiguity. */
QuotePos = pos( '"', parms ) /* quotes in the filespec? */
select
when QuotePos = 0 then parse var parms FSpec FN FT FM . /* none */
when QuotePos = 1 /* starts with a quote */
then do
if pos( '"', parms, 2 ) = 0 then signal help /* mismatched quotes */
parse var parms '"' FSpec '"' FN FT FM .
end
otherwise signal help /* quote in the middle */
end
if length( FM ) > 2 then signal help /* invalid filemode */
/* FSpec = translate( FSpec, '\', '/' ) translate slash to backslash */
/* Try to build a reasonable default CMS FN FT FM from the filespec
in case they are not specified */
NamePos = max( lastpos( ':', FSpec ), lastpos( '\', FSpec ) )
NamePos = max( NamePos, lastpos( '/', FSpec ) )
MicroName = substr( FSpec, NamePos + 1 ) /* strip path, if any */
MicroName = translate( MicroName, '.', ' ' ) /* convert blanks to .s */
parse var MicroName MicroFN '.' MicroFT /* split name & exten */
MicroFT = strip( MicroFT, 'BOTH', '.' ) /* strip multiple spaces */
if MicroFT = '' then MicroFT = 'UPLOADED' /* default FT */
if FN = '' | FN = '*' | FN = '=' then FN = MicroFN
if FT = '' | FT = '*' | FT = '=' then FT = MicroFT
if FM = '' | FM = '*' | FM = '=' then FM = 'A'
/* make sure disk is read/write since FT3270 module does not check */
Upper FM
'STATEW * * ' FM
If rc <> 0 Then Do
say "Error: disk '"FM"' is not accessible in write mode"
exit
End
/* Parse the options string */
rep = 'N' /* set default flags */
bin = 'D'
LRecl = ''
do while( opts ^= '' )
parse upper var opts opt opts /* get the next option word */
select
when datatype( opt, 'WHOLE' ) then LRecl = opt /* LRecl */
when abbrev( 'REPLACE', opt, 3 ) then rep = 'R' /* REPlace */
when abbrev( 'BINARY', opt, 3 ) then bin = 'B' /* BINary */
when abbrev( 'TEXT', opt, 3 ) then bin = 'T' /* TEXt */
otherwise do
say "Invalid option: '"opt"'"; exit 1
end
end /* end select */
end /* end do */
ConByte = 'U' || bin || rep || LRecl /* generate the control byte */
/* Remember whether messages etc. were on or off */
'CPSTACK LIFO QUERY SET'
pull . ; pull . ; pull .
pull 'IMSG' imsg ',' .
pull . ; pull .
pull 'MSG' msg ',' . 'WNG' wng ',' .
'CPSTACK Q C' /* CHECK READER SETTING */
pull 'RDR' rdrnum 'CL' rdrcl rdrcont rdrhold rdreof rdrready
'CP NOTREADY C'
/* Run the program; check rc; restore msg processing; & exit */
FN = translate( FN ) /* make sure CMS filespec is in upper case */
FT = translate( FT )
FM = translate( FM )
'FT3270 "'FSPEC'"' CONBYTE FN FT FM /* PERFORM THE UPLOAD */
rrc = rc
'CP SET MSG' msg
'CP SET WNG' wng
'CP SET IMSG' imsg
if rdrready = 'READY' then 'CP READY C'
exit rrc
/* Help screen -- Show the comments at the front of this file */
Help:
'VMFCLEAR'
do i = 2 while( sourceline( i ) ^= '*/' )
say sourceline( i )
end